Tolerate Authress redirects missing authenticationRequestId - #10
Merged
Conversation
Production logs show the hosted redirect can come back with a valid code but no authenticationRequestId query param at all (not merely a different one), which the mismatch check treated as a hard failure even when exactly one authentication request was pending. Since isRedirect() already confirms the deep link is exclusively ours, an unambiguous single pending request is trusted instead of failing the sign-in. The check still fails closed when a stale/abandoned attempt could make that assumption ambiguous.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Production logs showed a login redirect failing with "authentication request mismatch" even though only a single sign-in attempt was in flight:
Authress's hosted redirect can come back with a valid
codebut noauthenticationRequestIdquery parameter at all — not merely a different one. The existing mismatch check (added to detect stale redirects from an abandoned Custom Tab when a second sign-in attempt was started) treated this the same as a genuine mismatch and hard-failed the login, even though there was exactly one pending request and no ambiguity about which attempt the redirect belonged to.isRedirect()already confirms the deep link matches our exclusively-registeredredirectUri, so when there's no abandoned/stale attempt in flight, a single pending authentication request is unambiguous.completeAuthenticationRequest()inAuthressLoginClient.ktnow falls back to the stored pending request's ID when the redirect carries an emptyauthenticationRequestIdand there is no known abandoned request to confuse it with, using that ID for the token exchange.Test plan
AuthressLoginClient's network/Android dependencies🤖 Generated with Claude Code
https://claude.ai/code/session_01TeHGwaVdcZzxoVWawejRM5
Generated by Claude Code